package com.heima.wemedia.controller;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.AdSensitiveDto;
import com.heima.model.wemedia.dtos.SensitivePageDto;
import com.heima.model.wemedia.entity.WmSensitive;
import com.heima.wemedia.service.SensitiveService;
import org.simpleframework.xml.Path;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController  {

    @Resource
    private SensitiveService sensitiveService;

    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody AdSensitiveDto adSensitiveDto){

        return sensitiveService.save(adSensitiveDto);
    }

    @PostMapping("/list")
    public ResponseResult listSensitive(@RequestBody SensitivePageDto dto){

        return sensitiveService.list(dto);
    }


    /**
     * 更新敏感词
     * @param adSensitiveDto
     * @return
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitiveDto adSensitiveDto){
        return sensitiveService.update(adSensitiveDto);
    }

    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id ){


        return sensitiveService.delete(id);
    }






}
